package com.school.test.search.function.assist;

import com.school.test.search.plugin.mongo.MongoDb;
import com.mongodb.client.MongoCollection;
import org.bson.Document;

/**
 * @author 马洁
 * @date 2019/12/21 - 20:10
 */
public class IndexAssist {
    public static MongoCollection<Document> getExam() {
        return MongoDb
                .use()
                .getCollection("new_exam");
    }

    public static String getSemester() {
        Document document = MongoDb
                                .use()
                                .getCollection("semester")
                                .find()
                                .first();

        if (document != null) {
            return document.getString("semester");
        } else {
            return null;
        }
    }
}
